import React from "react";
import {createBrowserRouter} from 'react-router-dom'

import MainLayout from "../layouts/MainLayout";
import MangeLayout from "../layouts/MangeLayout";
import QuestionLayout from "../layouts/QuestionLayout";
import Home from "../pages/Home";
import Login from "../pages/Login";
import Register from "../pages/Register";
import NotFound from "../pages/NotFound";
import List from "../pages/manager/List";
import Trash from "../pages/manager/Trash";
import Star from "../pages/manager/Star";
import Edit from "../pages/question/Edit";
import Stat from "../pages/question/Stat";

const router=createBrowserRouter([
    {
        path:'/',
        element:<MainLayout/>,
        children:[
            {
                path:'/',
                element:<Home/>,
            },
            {
                path:'/login',
                element:<Login/>
            },
            {
                path:'/register',
                element:<Register/>
            },
            {
                path:'/manage',
                element:<MangeLayout/>,
                children:[
                    {
                        path:'list',
                        element:<List/>
                    },
                    {
                        path:'star',
                        element:<Star/>
                    },
                    {
                        path:'trash',
                        element:<Trash/>
                    },
                ]
            },
            {
                path:'*',//404配置
                element:<NotFound/>
            }
        ]
    },
    {
        path:'/question',
        element:<QuestionLayout/>,
        children:[
            {
                path:'edit/:id',
                element:<Edit/>
            },
            {
                path:'stat/:id',
                element:<Stat/>
            },
        ]
    }

])

export default router